# -*- coding: utf-8 -*-

#-----------------------------------------------------------------------------
# 库文件
#-----------------------------------------------------------------------------
import pandas as pd
import numpy as np

from log import *

#-----------------------------------------------------------------------------
# 文件变量，参数解析
#-----------------------------------------------------------------------------
# 导入命令行参数
from parse_definition import args

if (args.delimiter):
    delimiter = args.delimiter
else:
    delimiter = ','

#-----------------------------------------------------------------------------
# 函数定义
#-----------------------------------------------------------------------------

# 定义底层函数，从数据中读取某一行某一列的值，跳过第一行以避免串口数据错误导致文件解析失败


def read_one_data(file_path, column, row):
    data = pd.read_csv(file_path, skiprows=row+1, delimiter=delimiter, nrows=1,
                       names=None, encoding="utf8", header=None, usecols=[column], engine="python")
    data = np.array(data)

    return data

# 将读取到的数据更新到该全局变量中



